<template>
    <div
        class="prepayment"
        v-loading="pageLoading"
        element-loading-background="rgba(255, 255, 255, 0.7)"
    >
        <cardComponent pageTitle="转账分期提前还款申请">
            <template slot="cardBody">
                <!-- 搜索表单模块 -->
                <el-form
                    class="searchForm"
                    ref="searchForm"
                    :model="searchForm"
                    :rules="rules"
                    :inline="true"
                    label-position="right"
                    size="small"
                    label-width="100px"
                >
                    <el-row>
                        <el-col :span="8">
                            <el-form-item label="账户类别:" class="text_fl">
                                <el-select
                                    v-model="searchForm.accttype"
                                    placeholder="请选择账户类别"
                                    clearable
                                    @change="changeCardList"
                                >
                                    <el-option
                                        v-for="item in AccountionTYPE_INFO"
                                        :label="item.label"
                                        :value="item.code"
                                        :key="item.label"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-button
                                type="primary"
                                size="small"
                                icon="el-icon-search"
                                @click="handleGetListData('first')"
                            >查 询</el-button>
                        </el-col>
                    </el-row>
                </el-form>

                <!-- 表格数据展示模块 -->
                <div v-show="isShowView">
                    <el-table
                        :data="tableData"
                        border
                        stripe
                        @row-click="handleSelectRow"
                        header-row-class-name="headerRow"
                        ref="showListTable"
                        class="heard-bg business_table tabscrollBody"
                        @selection-change="handleSelectionChange"
                    >
                        <el-table-column type="selection" label=" " min-width="55"></el-table-column>
                        <el-table-column label="交易日期">
                            <template slot-scope="scope">{{scope.row.BEGYM}}</template>
                        </el-table-column>
                        <el-table-column label="交易描述">
                            <template slot-scope="scope">{{scope.row.DESC1}}</template>
                        </el-table-column>
                        <el-table-column label="分期类型">
                            <template
                                slot-scope="scope"
                            >{{scope.row.MPTYPE | filterMPTYPE(mptypeList)}}</template>
                        </el-table-column>
                        <el-table-column label="分期金额">
                            <template slot-scope="scope">{{scope.row.MPAMT}}</template>
                        </el-table-column>
                        <el-table-column label="分期期数">
                            <template slot-scope="scope">{{scope.row.MPMTHS}}</template>
                        </el-table-column>
                        <el-table-column label="手续费分摊方式">
                            <template slot-scope="scope">{{scope.row.PRODID|getfeetype(mprateList)}}</template>
                        </el-table-column>
                        <el-table-column label="剩余本金">
                            <template slot-scope="scope">{{scope.row.REMPBAL}}</template>
                        </el-table-column>
                        <el-table-column label="剩余手续费">
                            <template slot-scope="scope">{{scope.row.REMFEE}}</template>
                        </el-table-column>
                        <el-table-column label="剩余期数">
                            <template slot-scope="scope">{{scope.row.PPLMTHS}}</template>
                        </el-table-column>
                        <el-table-column label="提前还款费率">
                            <template
                                slot-scope="scope"
                            >{{scope.row.PRODID|getrepayrate(mprateList)}}</template>
                        </el-table-column>
                        <el-table-column label="分期状态">
                            <template
                                slot-scope="scope"
                            >{{scope.row.STATUS | filterSTATUS(mpstatusList)}}</template>
                        </el-table-column>
                        <el-table-column label="卡号后四位">
                            <template slot-scope="scope">{{scope.row.CARDNBR | getFormatCard}}</template>
                        </el-table-column>
                    </el-table>
                    <el-table
                        :data="caleData"
                        border
                        stripe
                        header-row-class-name="headerRow"
                        ref="showListTable"
                        class="heard-bg business_table"
                    >
                        <el-table-column label="提前还款试算">
                            <template></template>
                        </el-table-column>

                        <el-table-column prop="REMAINAMT" label="分期未摊销本金"></el-table-column>

                        <el-table-column prop="REPAYFEE" label="提前还款手续费"></el-table-column>

                        <el-table-column
                            prop="REPAYTOTAL"
                            label="提前还款总金额=分期未摊销本金+提前还款手续费"
                            min-width="300"
                        ></el-table-column>

                        <el-table-column prop="ARREARS" label="总欠款=提前还款总金额+账面余额" min-width="200"></el-table-column>
                    </el-table>

                    <!-- 话术 -->
                    <div class="hstable_wrap" v-if="speechList.length!=0">
                        <el-table
                            :data="speechList"
                            border
                            stripe
                            header-row-class-name="headerRow"
                            ref="showListTable"
                            class="heard-bg business_table hstable"
                            @selection-change="handleSelectionChange1"
                        >
                            <el-table-column type="selection" label=" " min-width="55"></el-table-column>
                            <el-table-column label="业务话术">
                                <template slot-scope="scope">{{scope.row.content}}</template>
                            </el-table-column>
                        </el-table>
                    </div>

                    <div class="footer">
                        <el-button type="primary" size="small" @click="handlePrepaymentTrail">提前还款试算</el-button>
                        <el-button type="primary" size="small" @click="handlePrepayment">提前还款申请</el-button>
                        <el-button
                            type="primary"
                            @click="unbillqry"
                            v-show="isShowTrialDialog1"
                        >未出账单明细查询</el-button>
                    </div>
                </div>

                <!-- 提前还款提示弹框 -->
                <el-dialog
                    v-drag
                    title="提前还款提示信息"
                    :visible.sync="isShowTrialDialog"
                    width="500px"
                    :append-to-body="true"
                    top="30vh"
                    :close-on-click-modal="false"
                    center
                >
                    <el-table :data="trialData">
                        <el-table-column property="BEGYM" label="分期日期"></el-table-column>
                        <el-table-column property="MPAMT" label="分期金额"></el-table-column>
                        <el-table-column property="REPAYAMT" label="提前还款金额"></el-table-column>
                    </el-table>

                    <p class="text_center padding_top15">
                        <span style="color:#3a8ee6; ">您确认要办理提前还款申请吗？</span>
                    </p>
                    <span slot="footer" class="dialog-footer">
                        <el-button
                            size="small"
                            icon="el-icon-circle-close"
                            @click="isShowTrialDialog = false"
                        >取 消</el-button>
                        <el-button
                            type="primary"
                            size="small"
                            @click="handleDealTrance"
                            icon="el-icon-circle-check"
                        >确定</el-button>
                    </span>
                </el-dialog>
                <!-- 表格数据展示模块 -->
                <div v-show="isShowTrialDialog1" style="align:ceter;" title="提前还款结果">
                    <el-table :data="repayresultlData">
                        <el-table-column property="BEGYM" label="分期日期"></el-table-column>
                        <el-table-column property="MPAMT" label="分期金额"></el-table-column>
                        <el-table-column property="REPAYAMT" label="提前还款金额"></el-table-column>
                        <el-table-column property="REPAYRS" label="提前还款结果"></el-table-column>
                    </el-table>
                    <!-- <span slot="footer" class="dialog-footer">
                        <el-button type="primary" @click="handleCloseDialog"size="small" icon="el-icon-circle-check" >确定</el-button>
                    </span>-->
                </div>
            </template>
        </cardComponent>
    </div>
</template>

<script>
import moment from 'moment';
import { mapState } from 'vuex';
import { trimString, getDictSelectList, getBusinessMenuId } from '@/utils/Common';
import { LOANSTATUS_DAILYBASIS } from '@/utils/Contants';
import { isEmptyObject, ChangePage } from '@/utils/Object';
import cardComponent from '@/components/cardComponent/cardComponent.vue';

export default {
    name: 'prepayment',
    components: {
        cardComponent,
    },
    data() {
        return {
            pageLoading: false, // 页面loading
            nextButtonFlag: false, // 下翻页按钮 显示控制阀

            searchForm: { // 搜索表单字段
                startDate: '20000101', // 开始日期 默认为当前日期往前一个月
                endDate: moment(new Date()).format('YYYYMMDD'), // 结束日期 默认为当前日期
                accttype: '',
                cardno: '',
            },
            mptypeList: [],
            mpstatusList: [],
            caleData: [],
            tableData: [],
            resultlist: [],
            rules: { // 表单校验规则
                startDate: [
                    { required: true, message: '请选择起始日期', trigger: 'blur' },
                ],
                endDate: [
                    { required: true, message: '请选择结束日期', trigger: 'blur' },
                ],
            },
            startOptions: { // 开始日期选择 限制
                disabledDate: (time) => {
                    if (this.searchForm.endDate) {
                        return time.getTime() > new Date(moment(this.searchForm.endDate).format('YYYY-MM-DD HH:mm:ss')).getTime();
                    }
                },
            },
            endtOptions: { // 结束日期选择限制
                disabledDate: (time) => {
                    if (this.searchForm.startDate) {
                        return time.getTime() < new Date(moment(this.searchForm.startDate).format('YYYY-MM-DD HH:mm:ss')).getTime();
                    }
                },
            },
            currentSelectRow: '', //
            currentRowData: '', // 当前选择行的数据
            trialData: [], // 试算结果数据
            isShowTrialDialog: false, // 试算结果展示弹框
            isShowTrialDialog1: false, // 试算结果展示弹框
            repayresultlData: [],//提前还款结果
            pagingDataList: [], // 翻页上送字段列表
            currentPageIndex: 0, // 当前页
            isShowView: false,

            cardList: [],
            repayratelist: [],//提前还款手续费列表
            defaultcard: '',
            NEXTDAY_3077: '20000101',//翻页交易日期
            NEXTMPNO_3077: '0',//翻页分期付款序号
            RtnindFlag: '',//翻页标志
            selectedList: [],
            mprateList: [],
            speechList: [],//话术列表
            speechselectedList: [],
            MenuId: '',
        };
    },

    created() { },

    // 取缓存信息
    computed: mapState({
        cardInfo_3004: state => state.common.cardInfo_3004, // 默认卡信息
        defaultParams: state => state.common.defaultParams, // 接口默认参数
        pinFlag: state => state.common.pinFlag, // 是否密码检查标志
        AccountionTYPE_INFO: state => state.common.AccountionTYPE_INFO, //账户类别列表
        cardList_3601: state => state.common.cardList_3601, //卡列表
        isCurrentMenuInfo: state => state.menu.isCurrentMenuInfo,
        businessMenu: state => state.menu.businessMenu,
    }),

    filters: {
        // 状态 转译
        getStatusText(val) {
            let text = '';
            LOANSTATUS_DAILYBASIS.forEach((item) => {
                if (item.value === trimString(val)) {
                    text = item.label;
                }
            });
            return text;
        },
        // 取卡号后四位
        getFormatCard(val) {
            let card4end = ''
            card4end = val.trim()
            card4end = card4end.substring(card4end.length - 4)
            return card4end
        },
        // 格式化金额
        getFormatAmt(val) {
            let card4end = ''
            card4end = val.trim()
            card4end = card4end.substring(card4end.length - 4)
            return card4end
        },
        // 日期格式化
        getDateFormat(val) {
            if (val) {
                return moment(`${val}`).format('YYYY-MM-DD');
            }
            return '--';
        },
        filterSTATUS: (value, mpstatusList) => {
            value = (`${value}`).trim();
            for (let index = 0; index < mpstatusList.length; index++) {
                const element = mpstatusList[index];
                if (element.code === value) {
                    return element.label;
                }
            }
        },
        filterMPTYPE: (value, mptypeList) => {
            value = (`${value}`).trim();
            for (let index = 0; index < mptypeList.length; index++) {
                const element = mptypeList[index];
                if (element.code === value) {
                    return element.label;
                }
            }
        },
        getfeetype(val, mprateList) {
            let feetp = '';
            val = (`${val}`).trim();
            for (let index = 0; index < mprateList.length; index++) {
                const element = mprateList[index];
                if (element.code === val) {
                    let labelstr = element.label;
                    feetp = labelstr.split('-')[1] === '0' ? '一次性支付' : '按月分摊';

                }
            }
            if (feetp === '') {
                feetp = '按月分摊';
            }
            return feetp;
        },
        getrepayrate(val, mprateList) {
            let repayrate = '';
            val = (`${val}`).trim();
            for (let index = 0; index < mprateList.length; index++) {
                const element = mprateList[index];
                if (element.code === val) {
                    let labelstr = element.label;
                    repayrate = labelstr.split('-')[2] + '%';
                }
            }
            if (repayrate === '') {
                repayrate = '未配置费率';
            }
            return repayrate;
        },
    },
    async mounted() {
        this.MenuId = this.$route.params.id || '';
        this.mptypeList = await getDictSelectList('MP_TYPE', this);
        this.mprateList = await getDictSelectList('MP_RATE', this);
        this.mpstatusList = await getDictSelectList('MP_STATUS', this);
        //this.repayratelist = await getDictSelectList('MPREAPAYRATE', this);
        this.init();
    },
    methods: {
        async init() {
            console.log("默认账户类别：" + this.cardInfo_3004.CATEGORY);
            console.log("默认账户：" + this.cardInfo_3004.CARDNO);
            this.searchForm.accttype = this.cardInfo_3004.CATEGORY + '';
            this.defaultcard = this.cardInfo_3004.CARDNO;
            await this.getspeechList();
        },
        changeCardList(val) {
            console.log("当前账户类型：" + val);
            let hasDefault = false; //是否包含默认卡
            this.cardList = [];
            this.cardList_3601.forEach((item) => {
                if (item.CATEGORY + '' === val) {
                    this.cardList.push(item);
                    if (item.CARDNBR === this.cardInfo_3004.CARDNO) {
                        hasDefault = true;
                    }
                }
            });
            //包含默认卡，卡号显示默认卡，不包含，显示cardList里第一张卡号
            if (hasDefault) {
                this.defaultcard = this.cardInfo_3004.CARDNO;
            } else {
                this.defaultcard = this.cardList[0].CARDNBR;
            }


        },

        handleSelectionChange(val) {

            this.selectedList = val;

        },

        //根据菜单id查询话术列表
        async getspeechList() {
            console.log("this.isCurrentMenuInfo.id", this.isCurrentMenuInfo.id);
            var checkParam = {
                'id': this.MenuId || this.isCurrentMenuInfo.id,
            };
            this.$post.busiMenu.getlistByMenuId(checkParam).then((res) => {
                console.log("话术查询结果：", res);
                if (res.status === 200) { // http通讯成功
                    if (res.data.status == 0) { // 业务请求成功
                        this.speechList = res.data.content;
                    }
                }
            });
        },
        handleSelectionChange1(val) {

            this.speechselectedList = val;

        },
        // 3077分期付款交易明细查询
        handleGetListData(type) {

            if (type === 'first') {
                this.pageLoading = true;
                this.RtnindFlag = '';
                this.NEXTDAY_3077 = '20000101';
                this.NEXTMPNO_3077 = '';
                this.resultlist = [];
            }
            const appBody = {
                CARDNBR: this.defaultcard, // 卡号
                // 空或Z：全部  A：灵活分期 C：信用计划分期 B：余额转移 H：银联POS分期 L：大额分期 M：邮购分期  P：自行POS分期 S：深圳银联POS分期 Y：余额/账单分期 D：自动分期
                MPTYPE: '', // 分期付款类型
                OPERCODE: 1, // 操作代码  0全部返回  1可提前还款的分期交易    2可撤销的分期交易
                OPT: '1', // 查询方式 1-用卡号查询 2-用证件号码查询
                //CATE: this.accountType, // 账户类别 查询方式为2时，必填
                PINFLAG: this.pinFlag, // 是否检查密码标志
                BEGDAY: "20000101", // 起始日期
                ENDDAY: moment(new Date()).format('YYYYMMDD'), // 结束日期 两个月 内的
                RTNIND: this.RtnindFlag,// 翻页标志 首次传空， 翻页传1
                NEXTDAY: this.NEXTDAY_3077,// 首次查询时送查询起始日期， 下翻页查询时上送上次查询结果的最后一条记录返回的分期付款交易日期
                NEXTMPNO: this.NEXTMPNO_3077,// 首次查询时送起始序号，默认为0 下翻页查询时上送上次查询结果的最后一条记录返回的交易序号
            };
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '3077';
            defaultParams.body.appBody = appBody;
            // 3077交易

            this.$post.common.transPort(defaultParams).then((res) => {
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {
                        this.resultlist.push(...result.body.appBody.dataList);

                        if (result.body.appBody.RTNIND === '1') {
                            this.NEXTDAY_3077 = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].BEGYM;
                            this.NEXTMPNO_3077 = result.body.appBody.dataList[result.body.appBody.dataList.length - 1].MPNO;
                            // 修改翻页标志 
                            this.RtnindFlag = result.body.appBody.RTNIND
                            this.handleGetListData();

                        } else {
                            this.pageLoading = false;
                            console.log('this.InstallmentInfo_3077', this.resultlist);
                            this.tableData = this.resultlist.filter((item) => item.MPTYPE != 'W');
                            this.isShowView = true;

                            console.log("tabledata", this.tableData);
                            // this.$store.commit('common/UPDATE_CARD_INSTALLMENT_INFO', this.InstallmentInfo_3077);
                        }
                    } else {
                        this.pageLoading = false;
                        const errorMsg = `错误代码：${result.sysHead.rspCd}, 错误信息：${result.sysHead.rspMsg}`;
                        this.$alert(errorMsg, result.sysHead.rspDesc, {
                            customClass: 'error', type: 'error',
                        });
                        this.isShowView = true;
                    }
                } else {
                    this.pageLoading = false;
                    this.$alert('请求失败', '提示', {
                        customClass: 'error', type: 'error',
                    });
                }
            });
        },

        // 点击重置搜索表单
        handleReset() {
            this.$refs.searchForm.resetFields();
            // 清空当前选择行数据
            this.currentRowData = '';
            // 清空缓存翻页数据
            this.pagingDataList = [];
            // this.handleGetListData()
        },

        handleChange(row) {
            // console.log(this.$refs[row.MPNO], 'this.$refs[row.MPNO]')
            // this.$refs[row.MPNO].getElementsByTagName('input').blur()

            this.handleSelectRow(row);
        },

        // 选择表格行
        handleSelectRow(row) {

            this.currentSelectRow = row.MPNO;
            this.currentRowData = row;
        },




        getrepayrate(val) {
            let repayrate = '2.5';
            for (let index = 0; index < this.mprateList.length; index++) {
                const element = this.mprateList[index];
                if (element.code + '' === val.trim()) {
                    let labelstr = element.label;
                    repayrate = labelstr.split('-')[2];
                }
            }
            repayrate = parseFloat(repayrate) * 0.01;
            console.log("分期产品：" + val + ",提前还款手续费率：" + repayrate);
            return repayrate;
        },
        // 提前还款试算
        async handlePrepaymentTrail() {
            console.log(this.selectedList.length);
            if (this.selectedList.length === 0) {
                this.$alert('请先选择要办理提前还款的分期！', '提示', {
                    customClass: 'warning', type: 'warning',
                });
                return;
            }

            //根据选择的分期记录进行循环试算，试算结果累加
            let repayamttotal = '0';
            let repayfeetotal = '0';

            for (let i = 0; i < this.selectedList.length; i++) {
                let remainamt = this.selectedList[i].REMPBAL;
                let repayrate = this.getrepayrate(this.selectedList[i].PRODID);

                let repayfee = parseFloat(remainamt) * parseFloat(repayrate);


                repayamttotal = parseFloat(repayamttotal) + parseFloat(remainamt);
                repayfeetotal = parseFloat(repayfeetotal) + parseFloat(repayfee);
            }
            console.log('repayamttotal:' + repayamttotal + ',repayfeetotal:' + repayfeetotal);
            await this.getrs(repayamttotal, repayfeetotal);
        },

        async getrs(repayamttotal, repayfeetotal) {
            function ForDight(Dight, How) {
                var Dight = Math.round(Dight * Math.pow(10, How)) / Math.pow(10, How);
                return Dight;
            }

            //查询账面余额
            let balnce = await this.getLastBill();
            //提前还款总金额 = 提前还款本金 + 提前还款手续费
            let repaytotals = parseFloat(repayamttotal) + parseFloat(repayfeetotal);

            //总欠款 = 提前还款总金额 + 账单余额
            let arrears = parseFloat(repaytotals) + parseFloat(balnce);


            //const txt = `提前试算还款金额 = 上期账单剩余未还金额 + 未出账单取现金额（本金+手续费）+ 提前还款本金 + 提前还款息费 = ${parseFloat(lastunpay)} + ${parseFloat(unbillcash)} + ${parseFloat(repayamttotal)} + ${parseFloat(repayfeetotal)} = ${ForDight(bq, 2)}`;
            this.caleData = [
                {
                    REMAINAMT: ForDight(repayamttotal, 2),
                    REPAYFEE: ForDight(repayfeetotal, 2),
                    REPAYTOTAL: ForDight(repaytotals, 2),
                    ARREARS: ForDight(arrears, 2)
                }
            ];
        },
        async getLastBill() {
            let cashamt = '0';

            const appBody3001 = {
                CARDNO: this.defaultcard, // 卡号
                // 空或Z：全部  A：灵活分期 C：信用计划分期 B：余额转移 H：银联POS分期 L：大额分期 M：邮购分期  P：自行POS分期 S：深圳银联POS分期 Y：余额/账单分期 D：自动分期
                TRANYM: '0', // 分期付款类型
                OPTION: 'L', // 查询方式 1-用卡号查询 2-用证件号码查询
                //CATE: this.accountType, // 账户类别 查询方式为2时，必填
                PINFLAG: this.pinFlag, // 是否检查密码标志
            };
            const defaultParams3001 = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams3001.body.appHead.tranCode = '3001';
            defaultParams3001.body.appBody = appBody3001;
            // 3077交易

            await this.$post.common.transPort(defaultParams3001).then((res) => {
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    let flag = 1;
                    console.log('result', result);
                    if (result.sysHead.rspCd === '000000') {
                        if (result.body.appBody.BALNCEFLG === '-') {
                            flag = -1;
                        }
                        cashamt = parseFloat(result.body.appBody.BALNCE) * flag;
                    }
                }
            });


            console.log('cardInfo_3001', cashamt);
            return cashamt;

        },
        // 提前还款
        handlePrepayment() {
            console.log(this.selectedList.length);
            if (this.selectedList.length === 0) {
                this.$alert('请先选择要办理提前还款的分期！', '提示', {
                    customClass: 'warning', type: 'warning',
                });
                return;
            }

            console.log("this.selectedList.length", this.speechselectedList.length);
            if (this.speechselectedList.length != this.speechList.length) {
                this.$alert('话术尚未全部勾选！', '提示', {
                    customClass: 'warning', type: 'warning',
                });
                return;
            }
            this.trialData = [{
                BEGYM: '',
                MPAMT: '',
                REPAYAMT: ''
            }];

            for (let i = 0; i < this.selectedList.length; i++) {
                this.trialData[i] = {
                    BEGYM: this.selectedList[i].BEGYM,
                    MPAMT: this.selectedList[i].MPAMT,
                    REPAYAMT: this.selectedList[i].REMPBAL,
                }

            }
            console.log("this.triaData:", this.trialData);
            this.isShowTrialDialog = true;

        },


        // 跑4073交易
        handleDealTrance(val) {
            this.isShowTrialDialog = false;

            this.repayresultlData = [{
                BEGYM: '',
                MPAMT: '',
                REPAYAMT: '',
                OPERTP: '',
                REPAYRS: ''
            }];
            const pro = new Promise((resolve, reject) => {
                this.getcard4073(resolve, reject);
            });
            pro.then((dataList) => {
                console.log("dataList_then", dataList);
                this.repayresultlData = dataList;
            })
            this.isShowTrialDialog1 = true;
        },
        getcard4073(resolve, reject) {
            let dataList = [];
            this.selectedList.forEach(async (item) => {
                const appBody4073 = {
                    OPTION: '1', // 操作类型 1－按卡号 2－按证件号码
                    CARDNBR: this.defaultcard, // 卡号
                    //CARDNBR: '', // 卡号
                    MPNUMBER: item.MPNO, // 分期付款序号
                    IDNO: '', // 免除手续费，0-不免除，1-免除
                    CATE: this.searchForm.accttype,
                    ACTION: ''
                };

                console.log('appBody4073:', appBody4073);
                const params4073 = JSON.parse(JSON.stringify(this.defaultParams));
                params4073.body.appHead.tranCode = '4073';
                params4073.body.appBody = appBody4073;

                await this.$post.common.transPort(params4073).then((res) => {
                    if (res.status === 200) {
                        const result = JSON.parse(res.data.jsonRes);
                        console.log(result, '响应数据 -- 4073');

                        if (result.sysHead.rspCd === '000000') {
                            dataList.push({
                                BEGYM: item.BEGYM,
                                MPAMT: item.MPAMT,
                                REPAYAMT: item.REMPBAL,
                                REPAYRS: '交易成功'
                            });
                        } else {
                            console.log(item, '响应数据 -- 4073');
                            dataList.push({
                                BEGYM: item.BEGYM,
                                MPAMT: item.MPAMT,
                                REPAYAMT: item.REMPBAL,
                                REPAYRS: '交易失败，' + result.sysHead.rspMsg
                            });
                            console.log(item, '响应数据 -- 4073', this.repayresultlData);
                        }
                    } else {
                        dataList.push({
                            BEGYM: item.BEGYM,
                            MPAMT: item.MPAMT,
                            REPAYAMT: item.REMPBAL,
                            REPAYRS: '请求失败'
                        });
                    }
                });
                console.log('dataList', dataList);

                resolve(dataList);
            });
        },
        //跳转未出账单明细查询页面
        unbillqry() {
            this.MenuId = getBusinessMenuId('/businessSystem/unBillChecked', this.businessMenu);
            console.log('this.MenuId____', this.MenuId);
            this.$router.push({ name: 'unBillChecked', path: '/businessSystem/unBillChecked', params: { id: this.MenuId } });
        },
        // 关闭对话框
        handleCloseDialog() {
            this.isShowTrialDialog1 = false;
            this.handleGetListData('first');
        },
    },
};
</script>
<style rel="stylesheet/scss" lang="scss">
.prepayment {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;

    .mine .el-table {
        .el-radio {
            .el-radio__label {
                display: none;
                padding-left: 1px;
            }
        }
    }

    .searchForm {
        .el-form-item__content {
            display: inline-block;

            .el-select,
            .el-date-editor {
                /* max-width: 200px; */
            }
        }
    }
}
</style>
<style scoped lang="scss">
.prepayment {
    .buttonBox {
        margin: 30px 0;
        text-align: right;
    }

    .footer {
        text-align: center;
        margin-top: 30px;
    }
}

.trialDialog {
    .el-row {
        margin-bottom: 30px;

        .infoItem {
            .title {
                font-weight: 600;
                padding-right: 10px;
            }

            .info {
                color: #999;
            }
        }
    }
}
</style>
